package com.project.quiktask.tests;


import static org.junit.Assert.assertEquals;

import java.io.IOException;

import junit.framework.Assert;

import org.junit.Test;

import com.project.quiktask.controller.AddHandler;
import com.project.quiktask.util.Result;
import com.project.quiktask.util.Variable;

/**
 * 
 * @author PHAM MINH VIET
 *
 */

public class AddHandlerTest{
	Result result;
	AddHandler addHandler;
	@Test
	public void testAddEvent() {
		addHandler=new AddHandler();
		String testParameter="*,by 6pm 12/02/12";
		result=addHandler.execute(testParameter);
		assertEquals(Variable.NO_DESCRIPTION_TASK, result.getFeedback());
	}
	
	@Test
	public void testUndoAddEvent(){
		//test successful undo
		addHandler = new AddHandler();
		String testString="do homework,2pm 23/12/12 to 3pm 23/12/12,*";
		result=addHandler.execute(testString);
		assertEquals(Variable.FEEDBACK_ADD_SUCCESSFUL, result.getFeedback());
		result=addHandler.undo();
		String expected="Task: do homework"+" was deleted successfully";
		assertEquals(expected, result.getFeedback());
		
	}


}
